// Code generated using version 1.0.0 of worldgen/tools/kernelize_surfaces.py;
// refer to worldgen/surfaces/templates/mud.py which has the copyright and
// authors
DEVICE_FUNC void geo_mud(float3_nonbuiltin position, float3_nonbuiltin normal,
                         POINTER_OR_REFERENCE_ARG float *float_vars,
                         POINTER_OR_REFERENCE_ARG float3_nonbuiltin *offset) {
    float Value_DOT_001_FROM_geo_mud = float_vars[0];
    float Value_FROM_geo_mud = float_vars[1];
    float mix_2_fac_FROM_geo_mud = float_vars[2];
    float noise_texture_4_scale_FROM_geo_mud = float_vars[3];
    float voronoi_texture_2_scale_FROM_geo_mud = float_vars[4];
    float4_nonbuiltin Noise_SPACE_Texture__Color;
    node_shader_tex_noise(3, position, 0.0, 5.0, 2.0, 0.5, 0.0, NULL,
                          &Noise_SPACE_Texture__Color);
    float mix_2_fac__Value;

    mix_2_fac__Value = mix_2_fac_FROM_geo_mud;
    float4_nonbuiltin Mix__Color;
    node_shader_mix_rgb(0, MA_RAMP_MIX, mix_2_fac__Value,
                        Noise_SPACE_Texture__Color, float4_nonbuiltin(position),
                        &Mix__Color);
    float noise_texture_4_scale__Value;

    noise_texture_4_scale__Value = noise_texture_4_scale_FROM_geo_mud;
    float Noise_SPACE_Texture_DOT_001__Fac;
    node_shader_tex_noise(3, float3_nonbuiltin(Mix__Color), 0.0,
                          noise_texture_4_scale__Value, 2.0, 0.5, 0.0,
                          &Noise_SPACE_Texture_DOT_001__Fac, NULL);
    float voronoi_texture_2_scale__Value;

    voronoi_texture_2_scale__Value = voronoi_texture_2_scale_FROM_geo_mud;
    float Voronoi_SPACE_Texture__Distance;
    node_shader_tex_voronoi(
        3, SHD_VORONOI_F1, SHD_VORONOI_EUCLIDEAN, float3_nonbuiltin(Mix__Color),
        0.0, voronoi_texture_2_scale__Value, 1.0, 0.5, 1.0,
        &Voronoi_SPACE_Texture__Distance, NULL, NULL, NULL, NULL);
    float4_nonbuiltin ColorRamp__Color;

    float ColorRamp_positions[2]{0.0, 1.0};
    float4_nonbuiltin ColorRamp_colors[2]{
        float4_nonbuiltin(1.0, 1.0, 1.0, 1.0),
        float4_nonbuiltin(0.0, 0.0, 0.0, 1.0)};
    node_texture_valToRgb(2, ColorRamp_positions, ColorRamp_colors,
                          COLBAND_BLEND_RGB, COLBAND_INTERP_LINEAR,
                          COLBAND_HUE_NEAR, Voronoi_SPACE_Texture__Distance,
                          &ColorRamp__Color, NULL);
    float Float_SPACE_Curve__Value;

    float Float_SPACE_Curve_values[256]{0.0,
                                        0.00023091575712896883,
                                        0.00046183151425793767,
                                        0.0006927787908352911,
                                        0.0009264081018045545,
                                        0.0011613459791988134,
                                        0.0013963642995804548,
                                        0.0016348697245121002,
                                        0.0018781045218929648,
                                        0.0021214426960796118,
                                        0.0023680070880800486,
                                        0.002624072367325425,
                                        0.0028802298475056887,
                                        0.0031390562653541565,
                                        0.003412732621654868,
                                        0.0036864844150841236,
                                        0.003962777554988861,
                                        0.004259074106812477,
                                        0.004555488936603069,
                                        0.004855410661548376,
                                        0.005179542116820812,
                                        0.00550399674102664,
                                        0.005834595765918493,
                                        0.006191955413669348,
                                        0.006550142541527748,
                                        0.0069192578084766865,
                                        0.007315382827073336,
                                        0.007713302969932556,
                                        0.008129446767270565,
                                        0.008569980040192604,
                                        0.009013927541673183,
                                        0.009486133232712746,
                                        0.009976784698665142,
                                        0.010473320260643959,
                                        0.011010970920324326,
                                        0.011558203026652336,
                                        0.012117994949221611,
                                        0.012726017273962498,
                                        0.013337910175323486,
                                        0.013978269882500172,
                                        0.014653420075774193,
                                        0.01533688884228468,
                                        0.01606735587120056,
                                        0.016815930604934692,
                                        0.017581187188625336,
                                        0.018406767398118973,
                                        0.01923876255750656,
                                        0.020108703523874283,
                                        0.021017128601670265,
                                        0.021939150989055634,
                                        0.02292184717953205,
                                        0.023921508342027664,
                                        0.02495092898607254,
                                        0.0260387621819973,
                                        0.027138687670230865,
                                        0.028292115777730942,
                                        0.029475752264261246,
                                        0.030681416392326355,
                                        0.03196406736969948,
                                        0.03325623646378517,
                                        0.034593842923641205,
                                        0.03597908467054367,
                                        0.03738415241241455,
                                        0.038856908679008484,
                                        0.04035123810172081,
                                        0.04188113287091255,
                                        0.04347802698612213,
                                        0.04508975148200989,
                                        0.04675703123211861,
                                        0.04846222698688507,
                                        0.050193365663290024,
                                        0.05199742317199707,
                                        0.0538177564740181,
                                        0.05567844212055206,
                                        0.057602569460868835,
                                        0.05954232066869736,
                                        0.06153647601604462,
                                        0.06357022374868393,
                                        0.06562891602516174,
                                        0.06775294244289398,
                                        0.06989575922489166,
                                        0.0720720887184143,
                                        0.07432152330875397,
                                        0.0765783041715622,
                                        0.07887639850378036,
                                        0.0812339037656784,
                                        0.08360807597637177,
                                        0.08605138212442398,
                                        0.0885649025440216,
                                        0.09107843041419983,
                                        0.09359195828437805,
                                        0.09610547870397568,
                                        0.09866050630807877,
                                        0.10132651776075363,
                                        0.10405734181404114,
                                        0.10678815841674805,
                                        0.10951897501945496,
                                        0.11225593090057373,
                                        0.1150847002863884,
                                        0.11804527044296265,
                                        0.12100584805011749,
                                        0.12396642565727234,
                                        0.12692700326442719,
                                        0.12997648119926453,
                                        0.13316640257835388,
                                        0.13636860251426697,
                                        0.13957081735134125,
                                        0.14277751743793488,
                                        0.14609244465827942,
                                        0.14954708516597748,
                                        0.15300172567367554,
                                        0.1564563512802124,
                                        0.15996073186397552,
                                        0.1635943353176117,
                                        0.16731058061122894,
                                        0.1710268259048462,
                                        0.17475149035453796,
                                        0.17860053479671478,
                                        0.18258525431156158,
                                        0.1865699589252472,
                                        0.1905546933412552,
                                        0.19465859234333038,
                                        0.19890505075454712,
                                        0.20316201448440552,
                                        0.2074190080165863,
                                        0.21180680394172668,
                                        0.21633380651474,
                                        0.2208629548549652,
                                        0.2254219949245453,
                                        0.23011550307273865,
                                        0.2349119782447815,
                                        0.23970843851566315,
                                        0.24458745121955872,
                                        0.24959437549114227,
                                        0.2546479105949402,
                                        0.25972190499305725,
                                        0.26492148637771606,
                                        0.270215779542923,
                                        0.2755100429058075,
                                        0.28090113401412964,
                                        0.2863953709602356,
                                        0.2919076085090637,
                                        0.2974798381328583,
                                        0.3031453490257263,
                                        0.3088464140892029,
                                        0.3145827353000641,
                                        0.3203982710838318,
                                        0.32625311613082886,
                                        0.33212724328041077,
                                        0.3380621671676636,
                                        0.3440306782722473,
                                        0.35000813007354736,
                                        0.35602426528930664,
                                        0.36206263303756714,
                                        0.3681032061576843,
                                        0.37415754795074463,
                                        0.38021984696388245,
                                        0.38628089427948,
                                        0.39232879877090454,
                                        0.3983689546585083,
                                        0.40440911054611206,
                                        0.41040748357772827,
                                        0.4163810610771179,
                                        0.4223545789718628,
                                        0.42826879024505615,
                                        0.4341399073600769,
                                        0.44000548124313354,
                                        0.44580984115600586,
                                        0.451548308134079,
                                        0.4572693407535553,
                                        0.46294915676116943,
                                        0.4685322344303131,
                                        0.4740775227546692,
                                        0.47962284088134766,
                                        0.48503872752189636,
                                        0.490386426448822,
                                        0.49573081731796265,
                                        0.5010125041007996,
                                        0.5061762928962708,
                                        0.5113005638122559,
                                        0.516424834728241,
                                        0.5214294791221619,
                                        0.5263388156890869,
                                        0.5312296748161316,
                                        0.5361205339431763,
                                        0.5408600568771362,
                                        0.545518159866333,
                                        0.5501675605773926,
                                        0.5548169016838074,
                                        0.559318482875824,
                                        0.5637344121932983,
                                        0.568138837814331,
                                        0.5725432634353638,
                                        0.5768454670906067,
                                        0.5810316801071167,
                                        0.585191547870636,
                                        0.5893514156341553,
                                        0.5935004949569702,
                                        0.5974708199501038,
                                        0.6013897657394409,
                                        0.6053086519241333,
                                        0.6092274785041809,
                                        0.6130894422531128,
                                        0.6168069839477539,
                                        0.6204909086227417,
                                        0.6241747736930847,
                                        0.6278586387634277,
                                        0.6315107345581055,
                                        0.635073721408844,
                                        0.6385899186134338,
                                        0.6420825719833374,
                                        0.6455281376838684,
                                        0.6489429473876953,
                                        0.6523283123970032,
                                        0.6556649208068848,
                                        0.6589698791503906,
                                        0.6622405648231506,
                                        0.6654618382453918,
                                        0.668649435043335,
                                        0.6718025803565979,
                                        0.6749036908149719,
                                        0.6779696345329285,
                                        0.6810032725334167,
                                        0.6839848756790161,
                                        0.6869298815727234,
                                        0.6898430585861206,
                                        0.6927126049995422,
                                        0.6955423951148987,
                                        0.6983417272567749,
                                        0.70110684633255,
                                        0.7038308382034302,
                                        0.706527590751648,
                                        0.709198534488678,
                                        0.7118296027183533,
                                        0.7144378423690796,
                                        0.7170255780220032,
                                        0.719579815864563,
                                        0.7221153378486633,
                                        0.724635124206543,
                                        0.7271267771720886,
                                        0.7296053767204285,
                                        0.7320702075958252,
                                        0.7345153093338013,
                                        0.7369517087936401,
                                        0.7393746376037598,
                                        0.7417869567871094,
                                        0.7441935539245605,
                                        0.7465875744819641,
                                        0.7489782571792603,
                                        0.7513617277145386,
                                        0.7537413239479065,
                                        0.7561174631118774,
                                        0.7584902048110962,
                                        0.7608615159988403,
                                        0.7632309794425964,
                                        0.7656000256538391};
    int Float_SPACE_Curve_table_size = 256;
    node_float_curve(Float_SPACE_Curve_values, Float_SPACE_Curve_table_size,
                     1.0, float(ColorRamp__Color), &Float_SPACE_Curve__Value);
    float Value__Value;

    Value__Value = Value_FROM_geo_mud;
    float3_nonbuiltin Vector_SPACE_Math__Vector;
    node_shader_vector_math(
        NODE_VECTOR_MATH_MULTIPLY, float3_nonbuiltin(Float_SPACE_Curve__Value),
        float3_nonbuiltin(Value__Value), float3_nonbuiltin(0.0, 0.0, 0.0), 1.0,
        &Vector_SPACE_Math__Vector, NULL);
    float3_nonbuiltin Vector_SPACE_Math_DOT_001__Vector;
    node_shader_vector_math(NODE_VECTOR_MATH_ADD,
                            float3_nonbuiltin(Noise_SPACE_Texture_DOT_001__Fac),
                            Vector_SPACE_Math__Vector,
                            float3_nonbuiltin(0.0, 0.0, 0.0), 1.0,
                            &Vector_SPACE_Math_DOT_001__Vector, NULL);
    float3_nonbuiltin Vector_SPACE_Math_DOT_002__Vector;
    node_shader_vector_math(NODE_VECTOR_MATH_MULTIPLY,
                            Vector_SPACE_Math_DOT_001__Vector, normal,
                            float3_nonbuiltin(0.0, 0.0, 0.0), 1.0,
                            &Vector_SPACE_Math_DOT_002__Vector, NULL);
    float Value_DOT_001__Value;

    Value_DOT_001__Value = Value_DOT_001_FROM_geo_mud;
    float3_nonbuiltin Vector_SPACE_Math_DOT_003__Vector;
    node_shader_vector_math(NODE_VECTOR_MATH_MULTIPLY,
                            Vector_SPACE_Math_DOT_002__Vector,
                            float3_nonbuiltin(Value_DOT_001__Value),
                            float3_nonbuiltin(0.0, 0.0, 0.0), 1.0,
                            &Vector_SPACE_Math_DOT_003__Vector, NULL);

    if (offset != NULL)
        *offset = Vector_SPACE_Math_DOT_003__Vector;
}
